{template 'common/header'}
<style>
	.info-font-style{
		height:22px;line-height:22px;float: none !important;text-align: left;line-height: 20px;color: #fff;font-size: 14px; font-weight: bolder;text-shadow: 1px 1px 3px #666;
	}
	.code_num{
		padding: 2px 20px 10px;
		margin-top: 30px;
		position: relative;
		font-size: 17px;font-family: menlo,tahoma;text-shadow: 1px 1px 2px #666;line-height: 18px;color: #fff;
		text-align: left;
	}
</style>
<div class="main" ng-app>
	<script src="http://cdn.bootcss.com/angular.js/1.5.8/angular.min.js"></script>
	<form action="" method="post" id="coupon-form" class="form-horizontal" enctype="multipart/form-data">
		<div class="panel panel-default" id="step1">
			<div class="panel-heading">
				{$coupon_title}
			</div>
			<div class="panel-body">
				<div class="pull-left" style="width:320px;background:#F4F5F9;margin-right:20px;border:1px solid #E7E7EB">
					<div class="card-title card-title-bg">{$coupon_title}</div>
					<div class="card_section area" style="position: relative;padding: 15px 26px">
						<div class="shop-panel" id="color-purview" style="background: #a9d92d">
							<div class="logo-area">
								<span class="logo pull-left"><img src="{$setting['logourl']}" alt=""/></span>
								<div class="pull-left info-font-style"  id="brand_name">商户信息</div>
								<div class="pull-left info-font-style" ><p><b id="title-purview">{$coupon_title}标题</b></p></div>
								<div class="clear"></div>
							</div>
							<div class="barcode-area code_preview code_preview_3" style="display: block">
								<!--<div class="barcode"></div>-->
								<p class="code_num" style="">1513-2290-1878</p>
							</div>
							<!--<div class="msg-area">-->
								<!--<div class="tick-msg">-->
									<!--<p><b id="title-purview">{$coupon_title}标题</b></p>-->
									<!--&lt;!&ndash;<p id="sub-title-purview">{$coupon_title}副标题</p>&ndash;&gt;-->
								<!--</div>-->
								<!--&lt;!&ndash;<p id="sub-time-purview" style="text-align: center">有效期:{php echo date('Y-m-d')} ~ {php echo date('Y-m-d', time() + 30 * 86400)}</p>&ndash;&gt;-->
							<!--</div>-->
							<!--<div class="deco"></div>-->
							<div class="cicon">
								<a href="javascript:;" data-id="form1"><i class="fa fa-pencil"></i></a>
							</div>
						</div>
					</div>

					<!--<div class="card-dispose area">-->
						<!--<div class="unset" id="destroy_title">-->
							<!--<p>销券设置</p>-->
						<!--</div>-->
						<!--<div class="destroy_type_preview">-->
							<!--<div class="barcode-area code_preview code_preview_3" style="display: block">-->
								<!--<div class="barcode"></div>-->
								<!--<p class="code_num">1513-2290-1878</p>-->
							<!--</div>-->
							<!--<div class="qrcode-area code_preview code_preview_2">-->
								<!--<div class="qrcode"></div>-->
								<!--<p class="code_num">1513-2290-1878</p>-->
							<!--</div>-->
							<!--<div class="sn-area code_preview code_preview_1">1513-2290-1878</div>-->
							<!--<p style="text-align: center" id="notice-purview">请在付款时出示此券</p>-->
						<!--</div>-->
						<!--<div class="cicon">-->
							<!--<a href="javascript:;" data-id="form2"><i class="fa fa-pencil"></i></a>-->
						<!--</div>-->
					<!--</div>-->
					<div class="shop-detail">
						<ul class="list">
							<!--<li>-->
								<!--<div class="li-panel area">-->
									<!--<div class="li-content">{$coupon_title}设置</div>-->
									<!--<span class="ricon fa fa-angle-right"></span>-->
									<!--<div class="cicon">-->
										<!--<a href="javascript:;" data-id="form3"><i class="fa fa-pencil"></i></a>-->
									<!--</div>-->
								<!--</div>-->
							<!--</li>-->
							<li>
								<div class="li-panel area">
									<div class="li-content">适用门店</div>
									<span class="ricon fa fa-angle-right"></span>
									<div class="cicon">
										<a href="javascript:;" data-id="form4"><i class="fa fa-pencil"></i></a>
									</div>
								</div>
							</li>
						</ul>
					</div>
					<div class="shop-detail">
						<ul class="list">
							<li>
								<div class="li-panel">
									<div class="li-content">立即使用</div>
									<span class="ricon">系统已实现</span>
								</div>
							</li>
							<li>
								<div class="li-panel area" style="border-bottom: none">
									<div class="li-content" id="promotion_url_name">个人中心</div>
									<div class="ricon"><span id="promotion_url_sub_title">点击进入 </span><i class="fa fa-angle-right"></i></div>
									<div class="cicon">
										<a href="javascript:;" data-id="form6"><i class="fa fa-pencil"></i></a>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
				<div class="pull-left alert form form-area" style="width:700px;position:relative;display:block;" id="form1">
					<div class="arrow_in"></div>
					<h4 style="margin-top:20px;border-bottom: 1px solid #e6e9eb;padding-bottom: 10px">券面信息</h4>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否上架</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline">
								<input type="radio" value="1" name="is_display" checked/> 上架
							</label>
							<label class="radio-inline">
								<input type="radio" value="0" name="is_display"/> 下架
							</label>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 适用模块</label>
						<div class="col-sm-9 col-xs-12">
							<a href="javascript:;" class="btn btn-default" data-toggle="modal" data-target="#modules-modal">选择模块</a>
							<input type="hidden" name="module-select" value="" autocomplete="off" />
							<div class="js-modules-contain clearfix"></div>
							<div class="help-block">确定该券的适用模块，不选择则为全部可用</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 商户LOGO</label>
						<div class="col-sm-9 col-xs-12" id="logo_upload">
							{if COUPON_TYPE == WECHAT_COUPON}
							{php echo tpl_form_field_wechat_image('logo_url', $setting['logourl'], '', array('acid' => $acid, 'mode' => 'file_upload'));}
							{else}
							{php echo tpl_form_field_image('logo_url', $setting['logourl'])}
							{/if}
							<div class="help-block">商户LOGO大小不超过1M。像素为：300*300。仅支持JPG格式</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 商户名称</label>
						<div class="col-sm-9 col-xs-12">
							<input type="text" class="form-control" name="brand_name"/>
							<div class="help-block">商户名字,字数上限为12个汉字。 </div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 卡券颜色</label>
						{php echo tpl_coupon_colors('color', 'Color082');}
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> {$coupon_title}标题</label>
						<div class="col-sm-9 col-xs-12">
							<input type="text" class="form-control" id="edit_card_tit" name="title"/>
							<div class="help-block">建议填写{$coupon_title}“减免金额”及自定义内容，描述卡券提供的具体优惠。不超过9个字符</div>
						</div>
					</div>
					<!--<div class="form-group">-->
						<!--<label class="col-xs-12 col-sm-3 col-md-2 control-label"> {$coupon_title}副标题(可选)</label>-->
						<!--<div class="col-sm-9 col-xs-12">-->
							<!--<input type="text" class="form-control" name="sub_title"/>-->
							<!--<div class="help-block">不超过18个字符</div>-->
						<!--</div>-->
					<!--</div>-->
					{if $type == COUPON_TYPE_DISCOUNT}
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 折扣额度</label>
						<div class="col-sm-9 col-xs-12">
							<div class="input-group">
								<input type="text" class="form-control" name="discount" value="80"/>
								<span class="input-group-addon">折</span>
							</div>
							<div class="help-block">表示打折额度（百分比）。填30就是3折。填写整数</div>
						</div>
					</div>
					{elseif $type == COUPON_TYPE_CASH}
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 减免金额</label>
						<div class="col-sm-9 col-xs-12">
							<div class="input-group">
								<span class="input-group-addon">满</span>
								<input type="text" class="form-control" name="least_cost" value=""/>
								<span class="input-group-addon">减</span>
								<input type="text" class="form-control" name="reduce_cost"/>
								<span class="input-group-addon">元</span>
							</div>
						</div>
					</div>
					{elseif $type == COUPON_TYPE_GIFT}
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 礼品券详情</label>
						<div class="col-sm-9 col-xs-12">
							<textarea name="gift" id="gift" class="form-control" rows="7"></textarea>
						</div>
					</div>
					{elseif $type == COUPON_TYPE_GROUPON}
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 团购券详情</label>
						<div class="col-sm-9 col-xs-12">
							<textarea name="deal_detail" id="deal_detail" class="form-control" rows="7"></textarea>
						</div>
					</div>
					{elseif $type == COUPON_TYPE_GENERAL}
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 优惠券详情</label>
						<div class="col-sm-9 col-xs-12">
							<textarea name="default_detail" id="default_detail" class="form-control" rows="7"></textarea>
						</div>
					</div>
					{/if}
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px"> 有效期</label>
						<div class="col-sm-9 col-xs-12">
							<div class="radio">
								<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="1" name="time_type" checked/>固定日期 </label></div>
								{php echo tpl_form_field_daterange('time_limit', array('start' => date('Y-m-d'), 'end' => date('Y-m-d', time() + 30*86400)));}
							</div>
							<div class="radio">
								<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="2" name="time_type"/>领取后 </label></div>
								<div class="col-sm-3" style="margin-left:-15px">
									<select name="deadline" id="deadline" class="form-control">
										<?php
										for($i=0; $i<=90; $i++) {
											if(!$i) $n = '当'; else $n = $i;
											echo '<option value="'.$i.'">'.$n.'天</option>';
										}
										?>
									</select>
								</div>
								<div class="col-sm-3" style="padding-top:6px">有效,有效期</div>
								<div class="col-sm-3" style="margin-left:-15px">
									<select name="limit" id="limit" class="form-control">
										<?php
										for($i=1; $i<=90; $i++) {
											echo '<option value="'.$i.'">'.$i.'天</option>';
										}
										?>
									</select>
								</div>

							</div>
							<div class="radio">
								<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="3" name="time_type" checked/>永久有效 </label></div>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px">可用时段</label>
						<div class="col-sm-9 col-xs-12">
							<div class="radio">
								<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="1" name="time_type" checked/>全部时段 </label></div>
							</div>
							<div class="radio">
								<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="1" name="time_type" checked/>部分时段 </label></div>
								<div class="frm_controls frm_sub_range js_discount_select">
									<label class="frm_radio_label">日期：</label>
									<label class="frm_radio_label frm_checkbox_label " for="checkbox9">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">周一</span>
										<input type="checkbox" value="1" class="frm_checkbox" id="checkbox9" >
									</label>
									<label class="frm_radio_label frm_checkbox_label " for="checkbox10">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">周二</span>
										<input type="checkbox" value="2" class="frm_checkbox" id="checkbox10" >
									</label>
									<label class="frm_radio_label frm_checkbox_label " for="checkbox11">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">周三</span>
										<input type="checkbox" value="3" class="frm_checkbox" id="checkbox11" >
									</label>
									<label class="frm_radio_label frm_checkbox_label " for="checkbox12">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">周四</span>
										<input type="checkbox" value="4" class="frm_checkbox" id="checkbox12" >
									</label>
									<label class="frm_radio_label frm_checkbox_label " for="checkbox13">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">周五</span>
										<input type="checkbox" value="5" class="frm_checkbox" id="checkbox13" >
									</label>
									<label class="frm_radio_label frm_checkbox_label " for="checkbox14">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">周六</span>
										<input type="checkbox" value="5" class="frm_checkbox" id="checkbox14" >
									</label>
									<label class="frm_radio_label frm_checkbox_label " for="checkbox15">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">周日</span>
										<input type="checkbox" value="5" class="frm_checkbox" id="checkbox15" >
									</label>
								</div>
								<div class="frm_clear" style="float: left;margin: 0 34px;padding-top:12px;width: 100%"><a href="javascript:void(0);" class="js_add_time_period_first">添加时间段</a></div>
								<div class="js_hour_range_container" style="padding-top:12px;display: none;float: left;margin-left: 34px">
									<div class="control_group frm_msg_align">
										<label class="frm_radio_label">时间:</label>
										<span class="js_hour_range_list">
											<span class="time_range js_hour_range">
												<span class="frm_input_box frm_input_box_short">
													<input value="" name="" type="text" class=" valid js_hour_start form-control" placeholder="">
												</span>
												<span class=""> 至 </span>
												<span class="frm_input_box frm_input_box_short">
													<input value="" name="" type="text" class="form-control valid js_hour_end" placeholder="">
												</span>
											</span>
										</span>
										<a href="javascript:void(0);" class="time_range js_add_time_period" style="display: inline-block;">添加时间段</a>
										<a href="javascript:void(0);" class="time_range js_del_time_period">删除时间段</a>
									</div>
									<p class="frm_msg fail js_time_period_interval_fail" style="display: none;">结束时间必须大于起始时间,且多个时间段不能重叠</p>
									<p class="frm_msg fail js_time_period_fail" style="display: none;">请输入正确的时间格式</p>
									<p class="frm_tips">请使用24小时制输入时间，格式如11:00至14:30</p>
								</div>
							</div>
						</div>
					</div>
					<script>
						$(function () {
							$('.js_add_time_period_first').click(function () {
								$(this).hide();
								$('.js_hour_range_container').show();
							});
							$('.js_add_time_period').click(function () {
								var js_hour_range = $('.js_hour_range');
								var clone_j_h_r = js_hour_range.clone();
								$(this).hide()
								$('.js_hour_range_list').append(clone_j_h_r)
							});
							$('.js_del_time_period').click(function () {
								var js_hour_range_length = $('.js_hour_range').length;
								if(js_hour_range_length==1){
									$(this).parents('.js_hour_range_container').hide();
									$('.js_add_time_period_first').show()
								}
								if(js_hour_range_length==2){
									$('.js_hour_range').last().remove();
									$('.js_add_time_period').show();
								}
							})
							var submsg_ipt = $('.input_submsg').find('input');
							submsg_ipt.blur(function () {
								if($(this).val()<=0){
									$(this).parents('.input_submsg').next().show()
								}else{
									$(this).parents('.input_submsg').next().hide()
								}
							})
						})
					</script>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px">会员卡优惠</label>
						<div class="col-sm-9 col-xs-12">
							<div class="radio">
								<div class="frm_controls frm_sub_range js_discount_select">
									<label class="frm_radio_label frm_checkbox_label " for="js_supply_bonus">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">积分优惠</span>
										<input type="checkbox" value="1" class="frm_checkbox" id="js_supply_bonus" >
									</label>
									<label class="frm_radio_label frm_checkbox_label " for="js_supply_discount">
										<i class="icon_checkbox"></i>
										<span class="lbl_content">折扣优惠</span>
										<input type="checkbox" value="1" class="frm_checkbox" id="js_supply_discount" >
									</label>
								</div>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px">会员卡优惠</label>
						<div class="col-sm-9 col-xs-12">
							<div class="input_submsg multi_input" style="padding-top: 10px">
								<span class="">
									<span class="">每消费</span>
									<span class="frm_input_box frm_input_box_short ">
										<input value="" name="cost_money_unit" type="text" class="frm_input frm_msg_content form-control" placeholder="">
									</span>
									<span class="">元，赠送</span>
									<span class="frm_input_box frm_input_box_short ">
										<input value="" id="js_increase_bonus" name="increase_bonus" type="text" class="frm_input form-control" placeholder="">
									</span>
									<span class="frm_input_append">积分</span>
								</span>
							</div>
							<p class="frm_msg fail" style="display: none;">
								<span for="cost_money_unit" class="frm_msg_content" style="display: inline;">消费金额和赠送积分只能大于0的整数</span>
							</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px">单次上限 <br><span class="tips">(选填)</span></label>
						<div class="col-sm-9 col-xs-12">
							<div class="input_submsg" style="padding-top: 10px;">
								<span class="frm_input_box ">
									<input value="" name="max_increase_bonus" type="text" class="frm_input form-control" placeholder="">
								</span>
								<span class="input_sub_msg">积分</span>
							</div>
							<p class="frm_tips">请设置单次增加积分的上限，不填写表示无限制</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px">激活送积分 <br><span class="tips">(选填)</span></label>
						<div class="col-sm-9 col-xs-12">
							<div class="input_submsg" style="padding-top: 10px;">
								<span class="frm_input_box">
									<input value="" name="init_bonus" type="text" class="frm_input form-control" placeholder="">
								</span>
								<span class="input_sub_msg">积分</span>
							</div>
							<p class="frm_tips">请设置激活会员卡赠送的积分，不填写表示不赠送</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px">积分抵扣</label>
						<div class="col-sm-9 col-xs-12">
							<div class="input_submsg multi_input" style="padding-top: 10px">
								<span class="">
									<span class="">订单满</span>
									<span class="frm_input_box frm_input_box_short">
										<input value="" id="cost_bonus_unit" name="cost_bonus_unit" type="text" class="frm_input frm_msg_content form-control" placeholder="">
									</span>
									<span class="">积分，抵扣</span>
									<span class="frm_input_box frm_input_box_short">
										<input value="" id="reduce_money" name="reduce_money" type="text" class="frm_input form-control" placeholder="">
									</span>
									<span class="frm_input_append">元</span>
								</span>
							</div>
							<p class="frm_msg fail" style="display: none;">
								<span for="js_cost_bonus_unit" class="frm_msg_content" style="display: inline;">积分只能填大于0的整数，金额大于0且只能到百分位</span>
							</p>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px">抵扣条件<br><span class="tips">(选填)</span></label>
						<div class="col-sm-9 col-xs-12">
							<div class="input_submsg multi_input" style="padding-top: 10px">
								<span class="">
									<span class="">订单满</span>
									<span class="frm_input_box frm_input_box_short">
										<input value="" name="least_money_to_use_bonus" type="text" class="frm_input frm_msg_content form-control" placeholder="">
									</span>
									<span class="">元可用，单笔上限</span>
									<span class="frm_input_box frm_input_box_short">
										<input value="" name="max_reduce_bonus" type="text" class="frm_input form-control" placeholder="">
									</span>
									<span class="frm_input_append">积分</span>
								</span>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px">享受折扣</label>
						<div class="col-sm-9 col-xs-12">
							<div class="input_submsg" style="padding-top: 10px;">
								<span class="frm_input_box">
									<input value="" name="discount" type="text" class="frm_input form-control" placeholder="">
								</span>
								<span class="input_sub_msg">折</span>
							</div>
							<p class="frm_msg fail" style="display: none;">
								<span for="js_discount" class="frm_msg_content" style="display: inline;">折扣额度只能是大于1且小于10的数字</span>
							</p>
							<p class="frm_tips">请填写1-9.9之间的数字，精确到小数点后1位</p>
						</div>
					</div>
					<h4 style="margin-top:20px;border-bottom: 1px solid #e6e9eb;padding-bottom: 10px">会员卡详情</h4>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px"> 特权说明</label>
						<div class="col-sm-9 col-xs-12">
							<div class="frm_textarea_box">
								<textarea class=" form-control" rows="10" name="prerogative" placeholder="注：1、上文设置中，如已经填写“积分优惠”“折扣优惠”的内容，将会自动在用户会员卡详情展示，无需重复填写。2、建议填写其他特权，举例：100积分可兑换精美礼品；会员日可享受折上折优惠等"></textarea>
							</div>
							<p class="frm_msg fail" style="display: none;"><span for="prerogative" class="frm_msg_content" style="display: inline;">特权说明不能为空</span></p>
						</div>
					</div>
					<script>
						$('.frm_textarea_box').find('textarea').blur(function () {
							if($(this).val()==''){
								$(this).parent().next().show()
							}else{
								$(this).parent().next().hide()
							}
						})
					</script>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"> 使用须知</label>
						<div class="col-sm-9 col-xs-12">
							<textarea name="description" id="description" class="form-control" rows="10" placeholder="注：1、上文设置中，如已经填写“积分优惠”“折扣优惠”的内容，将会自动在用户会员卡详情展示，无需重复填写。2、建议填写其他注意事项，举例：积分不支持兑换现金"></textarea>
						</div>
					</div>
					<h4 style="margin-top:20px;border-bottom: 1px solid #e6e9eb;padding-bottom: 10px">商户介绍（选填）</h4>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">客服电话</label>
						<div class="col-sm-9 col-xs-12">
							<input type="text" class="form-control" name="service_phone"/>
							<div class="help-block">手机或固话</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">客服电话</label>
						<div class="col-sm-9 col-xs-12">
							<div class="frm_controls frm_vertical_lh">
								<label class="frm_radio_label frm_checkbox_label" for="checkbox18">
									<i class="icon_checkbox"></i>
									<span class="lbl_content">免费WIFI</span>
									<input type="checkbox" value="0" class="frm_checkbox" id="checkbox18">
								</label>
								<label class="frm_radio_label frm_checkbox_label" for="checkbox19">
									<i class="icon_checkbox"></i>
									<span class="lbl_content">可带宠物</span>
									<input type="checkbox" value="1" class="frm_checkbox" id="checkbox19">
								</label>        
								<label class="frm_radio_label frm_checkbox_label" for="checkbox20">
									<i class="icon_checkbox"></i>
									<span class="lbl_content">免费停车</span>
									<input type="checkbox" value="2" class="frm_checkbox" id="checkbox20">
								</label>
								<label class="frm_radio_label frm_checkbox_label" for="checkbox21">
									<i class="icon_checkbox"></i>
									<span class="lbl_content">可外卖</span>
									<input type="checkbox" value="3" class="frm_checkbox" id="checkbox21">
								</label>
							</div>
						</div>
					</div>
				</div>
				<div class="pull-left alert form hidden form-area" style="width:700px;position:relative;" id="form2">
					<div class="arrow_in"></div>
					<h4 style="margin-top:20px;">领券设置</h4>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 库存</label>
						<div class="col-sm-9 col-xs-12">
							<div class="input-group">
								<input type="text" class="form-control" name="quantity" value="300"/>
								<span class="input-group-addon">份</span>
							</div>
							<div class="help-block">库存只能是大于0的数字</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 领券限制</label>
						<div class="col-sm-9 col-xs-12">
							<div class="input-group">
								<input type="text" class="form-control" name="get_limit" value="1"/>
								<span class="input-group-addon">份</span>
							</div>
							<div class="help-block">默认领券限制为1</div>
						</div>
					</div>
					{if COUPON_TYPE == WECHAT_COUPON}
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
						<div class="col-sm-9 col-xs-12">
							<div class="checkbox">
								<label><input type="checkbox" name="can_share" value="1" checked /> 用户可以分享领券链接</label>
							</div>
							<div class="checkbox">
								<label><input type="checkbox" name="can_give_friend" value="1" checked /> 用户领券后可转赠其他好友</label>
							</div>
						</div>
					</div>
					<h4 style="margin-top:20px;">销券设置</h4>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">销券方式</label>
						<div class="col-sm-9 col-xs-12">
							<div class="radio">
								<label><input type="radio"  class="" name="code_type" value="1"/> 仅卡券号</label>
								<div class="help-block">只显示卡券号，验证后可进行销券</div>
							</div>
							<div class="radio">
								<label><input type="radio"  class="" name="code_type" value="2"/> 二维码</label>
								<div class="help-block">包含卡券信息的二维码，扫描后可进行销券</div>
							</div>
							<div class="radio">
								<label><input type="radio"  class="" name="code_type" value="3" checked/> 条形码</label>
								<div class="help-block">包含卡券信息的条形码，扫描后可进行销券</div>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 操作提示</label>
						<div class="col-sm-9 col-xs-12">
							<input type="text" class="form-control" name="notice" id="notice" value="请在付款时出示此券"/>
							<div class="help-block">建议引导用户到店出示卡券，由店员完成核销操作。不超过16个字符</div>
						</div>
					</div>
					{/if}
				</div>
				<div class="pull-left alert form hidden form-area" style="width:700px;position:relative;" id="form3">
					<div class="arrow_in"></div>
					<!--<h4 style="margin-top:20px;">{$coupon_title}详情</h4>-->
					<!--<div class="form-group">-->
						<!--<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px"><span class="text-danger">*</span> 特权说明</label>-->
						<!--<div class="col-sm-9 col-xs-12">-->
							<!--<div class="frm_textarea_box">-->
								<!--<textarea class=" form-control" rows="10" name="prerogative" placeholder="注：1、上文设置中，如已经填写“积分优惠”“折扣优惠”的内容，将会自动在用户会员卡详情展示，无需重复填写。2、建议填写其他特权，举例：100积分可兑换精美礼品；会员日可享受折上折优惠等"></textarea>-->
							<!--</div>-->
						<!--</div>-->
					<!--</div>-->
					<!--<div class="form-group">-->
						<!--<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 使用须知</label>-->
						<!--<div class="col-sm-9 col-xs-12">-->
							<!--<textarea name="description" id="description" class="form-control" rows="10" placeholder="注：1、上文设置中，如已经填写“积分优惠”“折扣优惠”的内容，将会自动在用户会员卡详情展示，无需重复填写。2、建议填写其他注意事项，举例：积分不支持兑换现金"></textarea>-->
						<!--</div>-->
					<!--</div>-->
					<!--<div class="form-group">-->
						<!--<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 客服电话</label>-->
						<!--<div class="col-sm-9 col-xs-12">-->
							<!--<input type="text" class="form-control" name="service_phone"/>-->
							<!--<div class="help-block">手机或固话</div>-->
						<!--</div>-->
					<!--</div>-->
				</div>
				<div class="pull-left alert form hidden form-area" style="width:700px;position:relative;" id="form4">
					<input type="hidden" name="location-select" value="" autocomplete="off"/>
					<input type="hidden" name="groups" value="" autocomplete="off"/>
					<div class="arrow_in"></div>
					<h4 style="margin-top:20px;">服务信息</h4>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 适用门店</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio"><a href="javascript:;" data-toggle="modal" data-target="#location-store-modal">选择适用门店</a></label>
							<div class="js-location-contain"></div>
							<div class="help-block">默认为适用于全部门店</div>
						</div>
					</div>
					{if COUPON_TYPE == WECHAT_COUPON}
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 可用会员组</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio"><a href="javascript:;" data-toggle="modal" data-target="#groups-modal">选择可用会员组</a></label>
							<div class="js-groups-contain"></div>
							<div class="help-block">默认为全部用户组可用</div>
						</div>
					</div>
					{/if}
				</div>
				<div class="pull-left alert form hidden form-area" style="width:700px;position:relative;" id="form6">
					<div class="arrow_in"></div>
					<h4 style="margin-top:20px;">营销入口</h4>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 营销场景的自定义入口名称</label>
						<div class="col-sm-9 col-xs-12">
							<input type="text" class="form-control" name="promotion_url_name" value="个人中心"/>
							<div class="help-block">如：个人中心。</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 跳转链接</label>
						<div class="col-sm-9 col-xs-12">
							<input type="text" class="form-control" name="promotion_url" value="{php echo murl('mc/home', array(), true, true);}"/>
							<div class="help-block">入口跳转链接地址。需要以"http://"或"https://"开头</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 营销入口右侧的提示语</label>
						<div class="col-sm-9 col-xs-12">
							<input type="text" class="form-control" name="promotion_url_sub_title" value="点击进入"/>
							<div class="help-block">营销入口右侧的提示语.不超过6个汉字</div>
						</div>
					</div>
				</div>
				</div>
		</div>
		<div class="form-group col-sm-12">
			<input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>

<div id="footer-location" class="hide">
	<span name="submit" id="submit" class="pull-right btn btn-primary">保存</span>
</div>

<script>
	$('.list li,.card-dispose,.shop-panel').hover(function(){
		$(this).find('.cicon').show();
		$(this).addClass('hover');
	}, function(){
		$(this).find('.cicon').hide();
		$(this).removeClass('hover');
	});
	$('#form1').mouseover(function(){
		var bg_color = $(':input[name="color-value"]').val();
		if(!bg_color) {
			bg_color = '#a9d92d';
		}
		$('#color-purview').css('background-color', bg_color);
		if($(':input[name="title"]').val()) {
			$('#title-purview').html($(':input[name="title"]').val());
		}
		if($(':input[name="sub_title"]').val()) {
			$('#sub-title-purview').html($(':input[name="sub_title"]').val());
		}
		if($(':input[name="brand_name"]').val()) {
			$('#brand_name').html($(':input[name="brand_name"]').val());
		}
		$('.logo-area img').attr('src', $('#logo_upload img').attr('src'));
		var time_type = $(':radio[name="time_type"]:checked').val();
		var time = '';
		if(time_type == 1) {
			var startime = $("input[name='time_limit[start]']").val();
			var endtime = $("input[name='time_limit[end]']").val();
			time = '有效期:'+startime+'~'+endtime;
		} else if(time_type == 2) {
			var deadline = parseInt($('#deadline').val());
			var limit = parseInt($('#limit').val());
			var now = new Date();
			now.setHours(0, 0, 0);
			var unixtime =Date.parse(now)/1000;
			unixtime += (deadline*86400);
			var startime = new Date(parseInt(unixtime) * 1000).toLocaleString().substr(0,9).replace(/\//g, "-");
			unixtime += (limit*86400);
			var endtime = new Date(parseInt(unixtime) * 1000).toLocaleString().substr(0,9).replace(/\//g, "-");
			time = '有效期:'+startime+'~'+endtime;
		}
		$('#sub-time-purview').html(time);
	});
	$('#edit_card_tit').keypress(function () {
		$('.title-purview').text($(this).text())
	})
	$('.icon_checkbox').click(function () {
		$(this).parent().toggleClass('selected');
		if ($(this).siblings('.frm_checkbox').attr("checked")) {
			$(this).siblings('.frm_checkbox').removeAttr("checked");
		}
		else {
			$(this).siblings('.frm_checkbox').attr("checked", 'true');
		}
	})
	$('.area').click(function() {
		$(this).find('.cicon a').children().trigger('click');
	});
	$('.cicon a').click(function(){
		$('.form').addClass('hidden');
		var top = $(this).offset().top;
		$('#'+$(this).attr('data-id')).css('margin-top',(top-300))
		$('#'+$(this).attr('data-id')).removeClass('hidden');
		return false;
	})

	$('#form2').mouseover(function(){
		var code_type = $('#form2 :radio[name="code_type"]:checked').val() || 0;
		if(code_type) {
			$('#destroy_title').hide();
			$('.code_preview').hide();
			$('.code_preview_' + code_type).show();
		}
		$('#notice-purview').html($('#form2 :text[name="notice"]').val());
	});

	$('#coupon-form').submit(function(){
		if(!$.trim($(':input[name="brand_name"]').val())) {
			util.message('请填写商户名称', '','error');
			return false;
		}

		if(!$.trim($(':input[name="color-value"]').val())) {
			util.message('请选择卡券颜色', '','error');
			return false;
		}

		{if $type == COUPON_TYPE_DISCOUNT}
		if(!$.trim($(':text[name="discount"]').val())) {
			util.message("折扣额度不合法",'','error');
			return false;
		}
		{elseif $type == COUPON_TYPE_CASH}
		if(!$.trim($(':text[name="reduce_cost"]').val())) {
			util.message("减免金额不合法",'','error');
			return false;
		}
		if(!$.trim($(':text[name="least_cost"]').val())) {
			util.message("抵扣金额不合法",'','error');
			return false;
		}
		{/if}
		if(!$.trim($(':input[name="title"]').val())) {
			util.message('{$coupon_title}标题不能为空', '','error');
			return false;
		}

		var time_type = $(':radio[name="time_type"]:checked').val();
		if(!time_type) {
			util.message('请完善{$coupon_title}有效期', '','error');
			return false;
		}

		var quantity = parseInt($.trim($(':text[name="quantity"]').val()));
		if(isNaN(quantity)) {
			util.message("库存只能是大于0的数字",'','error');
			return false;
		}
		{if COUPON_TYPE == WECHAT_COUPON}
		var code_type = $(':radio[name="code_type"]:checked').val();
		if(!code_type) {
			util.message('请选择销券方式','','error');
			return false;
		}
		if(!$.trim($(':text[name="notice"]').val())) {
			util.message('请完善操作提示', '','error');
			return false;
		}
		{/if}
		if(!$.trim($('textarea[name="description"]').val())) {
			util.message('请完善使用须知', '','error');
			return false;
		}
		
		$('#submit').attr('disabled', true);
		return true;
	});

	//选择门店
	$('.js-select-store').click(function(){
		var chks = $('input[name="locationids[]"]:checked');
		var locations = [];
		$('.js-location-contain').html('')
		if(chks.length>0){
			$.each(chks, function(){
				$('.js-location-contain').append('<span class="label label-success">'+$(this).data('name')+'</span>&nbsp;');
				locations.push($(this).val());
			});
			$('input[name=location-select]').val(locations.join('-'));
		} else {
			$('input[name="location-select"]').val('');
		}
	});
	//选择可用用户组
	$('.js-select-groups').click(function(){
		var chks = $('input[name="groupids[]"]:checked');
		var groupids = [];
		$('.js-groups-contain').html('');
		if (chks) {
			$.each(chks, function(){
				$('.js-groups-contain').append('<span class="label label-success">'+$(this).data('name')+'</span>&nbsp;');
				groupids.push($(this).val());
			});
			$('input[name=groups]').val(groupids.join('-'));
		} else {
			$('input[name=groups]').val('');
		}
	});
	//选择模块
	$('.js-select-modules').click(function(){
		var chks = $('input[name="modules[]"]:checked');
		var moduleids = [];
		$('.js-modules-contain').html('');
		if (chks) {
			$.each(chks, function(){
				$('.js-modules-contain').append('<span class="label label-success pull-left" style="margin:5px ;">'+$(this).data('name')+'</span>&nbsp;');
				moduleids.push($(this).val());
			});
			$('input[name=module-select]').val(moduleids.join('@'));
		} else {
			$('input[name=module-select]').val('');
		}
	});
	//初始化checkbox状态
	$('input[name$="[]"]').prop('checked', false);
</script>
{template 'common/footer'}